package com.jeff.tianti.controller;


import com.jeff.tianti.common.ColumnInfoCom;
import com.jeff.tianti.common.dto.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@CrossOrigin(maxAge = 3600)
@RestController
@RequestMapping("/cms")
public class CmsColumnInfoController {

    @Autowired
    private ColumnInfoCom columnInfoCom;

    /**
     * @Ceator:liuYI
     * @Describe:根据传进来的父code/id获取对应子cms_column_info的name并封装map
     * @Return key:code value:name
     */
    @RequestMapping(value = "/findAttrByParentIdOrCode", method = RequestMethod.GET)
    public AjaxResult getColumnByCode(@RequestParam("code") String code) {
        Map sda = columnInfoCom.findColumnInfoList(code);
        return AjaxResult.setSuccessData(sda);
    }   /**
     * @Ceator:liuYI
     * @Describe:根据传进来的父code/id获取对应子cms_column_info的name并封装map
     * @Return key:code value:name
     */
    @RequestMapping(value = "/findAttrListByParentIdOrCode", method = RequestMethod.GET)
    public AjaxResult getColumnListByCode(@RequestParam("code") String code) {

        return AjaxResult.setSuccessData(columnInfoCom.getList(code));
    }


}
